package com.sh.intermediate_control;

import android.health.connect.datatypes.ExerciseCompletionGoal;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class EditFocusActivity extends AppCompatActivity implements View.OnFocusChangeListener {

    private EditText ed_phone;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_edit_focus);
        ed_phone = findViewById(R.id.ed_phone);
        EditText de_password = findViewById(R.id.ed_password);
        Button btn_login = findViewById(R.id.btn_login);


        de_password.setOnFocusChangeListener(this);


    }

    @Override
    public void onFocusChange(View v, boolean hasFocus) {

        if (hasFocus) {
            String pho = ed_phone.getText().toString();
            if (TextUtils.isEmpty(pho) || pho.length() < 11) {
                ed_phone.requestFocus();
                Toast.makeText(this, "请输入11位手机号码", Toast.LENGTH_SHORT).show();
            }
        }


    }
}